﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace motelmanagement.useInterface
{
    public partial class test : DevComponents.DotNetBar.Controls.SlidePanel
    {
        public test()
        {
            InitializeComponent();
            //MinimumSize = new Size(300, 50);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            var g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            int steps = 3;
            int radiusBig = 20;
            int radiusSmall = 15;
            int bgHeight = 10;

            var gradientRect = new Rectangle(ClientRectangle.X + (ClientRectangle.Width - radiusBig * 2) / (steps - 1),
                                             ClientRectangle.Y + ClientRectangle.Height / 2 - radiusBig - 1, radiusBig * 2, radiusBig * 2);

            var lightGrayBrush = new LinearGradientBrush(ClientRectangle, Color.FromArgb(224, 227, 214), Color.LightGray, LinearGradientMode.Vertical);
            var darkGrayBrush = new LinearGradientBrush(gradientRect, Color.DarkGray, Color.Gray, LinearGradientMode.Vertical);
            var lightGreenBrush = new LinearGradientBrush(ClientRectangle, Color.FromArgb(206, 217, 79), Color.FromArgb(191, 201, 82), LinearGradientMode.Vertical);
            var darkGreenBrush = new LinearGradientBrush(ClientRectangle, Color.YellowGreen, Color.ForestGreen, LinearGradientMode.Vertical);

            g.FillRectangle(darkGrayBrush, ClientRectangle.X + radiusBig, ClientRectangle.Y + ClientRectangle.Height / 2 - bgHeight / 2 - 1,
                            ClientRectangle.Width - radiusBig * 2, bgHeight);

            g.FillRectangle(lightGrayBrush, ClientRectangle.X + radiusBig, ClientRectangle.Y + ClientRectangle.Height / 2 - bgHeight / 2,
                            ClientRectangle.Width - radiusBig * 2, bgHeight);

            for (int i = 1; i <= steps; i++)
            {
                g.FillEllipse(darkGrayBrush, ClientRectangle.X + ((ClientRectangle.Width - radiusBig * 2) / (steps - 1)) * (i - 1),
                              ClientRectangle.Y + ClientRectangle.Height / 2 - radiusBig - 1, radiusBig * 2, radiusBig * 2);
                g.FillEllipse(lightGrayBrush, ClientRectangle.X + ((ClientRectangle.Width - radiusBig * 2) / (steps - 1)) * (i - 1),
                              ClientRectangle.Y + ClientRectangle.Height / 2 - radiusBig, radiusBig * 2, radiusBig * 2);
            }

            for (int i = 1; i <= steps - 1; i++)
            {
                g.FillEllipse(darkGreenBrush,
                              ClientRectangle.X + ((ClientRectangle.Width - radiusBig * 2) / (steps - 1)) * (i - 1) + radiusBig - radiusSmall,
                              ClientRectangle.Y + ClientRectangle.Height / 2 - radiusSmall - 1, radiusSmall * 2, radiusSmall * 2);
                g.FillEllipse(lightGreenBrush,
                              ClientRectangle.X + ((ClientRectangle.Width - radiusBig * 2) / (steps - 1)) * (i - 1) + radiusBig - radiusSmall,
                              ClientRectangle.Y + ClientRectangle.Height / 2 - radiusSmall, radiusSmall * 2, radiusSmall * 2);
            }

        }
        protected override void OnResize(EventArgs e)
        {
            // Center the panel
            metroTilePanel1.Location = new Point((this.Width - metroTilePanel1.Width) / 2 + 16);//, ((this.Height - labelX1.Height - 16) - metroTilePanel1.Height) / 2 + labelX1.Height + 16);
            base.OnResize(e);
        }

        private void labelX1_Click(object sender, EventArgs e)
        {
           
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            this.SuspendLayout();
            test2 ts1 = new test2();
            this.Controls.Add(ts1);
            ts1.BringToFront();
            ts1.SlideSide = DevComponents.DotNetBar.Controls.eSlideSide.Left;
            this.ResumeLayout(false);
            //this.IsOpen = false;
            this.SlideOutButtonVisible = false;
        }   
    }
}
